package mypackage.servicce.Impl;

import mypackage.bean.GoodOrder;
import mypackage.dao.GoodOrderDao;
import mypackage.dao.impl.GoodOrderDaoImpl;
import mypackage.servicce.GoodOrderService;

import java.util.List;

/**
 * @author YH925
 * @create 2021/12/10 22:08
 */
public class GoodOrderServiceImpl implements GoodOrderService {
    private final GoodOrderDao dao = new GoodOrderDaoImpl();
    @Override
    public void insertData(int clientId, String goodId, int amount, double price) {
        dao.insertData(clientId, goodId, amount, price);
    }

    @Override
    public List<GoodOrder> findGoodChart(int clientId) {
        return dao.findGoodChart(clientId);
    }

    @Override
    public List<GoodOrder> findGoodChartWithGood(int clientId) {
        return dao.findGoodChartWithGood(clientId);
    }

    @Override
    public int findTotalGoodsFromChart(int clientId) {
        return dao.findTotalGoodsFromChart(clientId);
    }

    @Override
    public double findTotalPriceFromChart(int clientId) {
        return dao.findTotalPriceFromChart(clientId);
    }

    @Override
    public void deleteAllGoodsByClientId(int clientId) {
        dao.deleteAllGoodsByClientId(clientId);
    }

    @Override
    public void deleteOneGoodById(int id) {
        dao.deleteOneGoodById(id);
    }

    @Override
    public void updateGoodAmount(int id, int newAmount) {
        dao.updateGoodAmount(id,newAmount);
    }

    @Override
    public GoodOrder isExistCurrentGood(int clientId, String goodId) {
        return dao.isExistCurrentGood(clientId,goodId);
    }
}
